<%--
  Created by IntelliJ IDEA.
  User: mengshun
  Date: 2022/3/18
  Time: 15:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>EL表达式的使用</title>
</head>
<body>

<%--
      简化页面中取值的方式 尽量的少些java代码   ${ }

      el表达式 支持基础的运算

      el 从作用域中取值     jsp    pageContext      request     session  application
--%>

<h1>1+2=${1+2}</h1>
<h1>1==2 ${1 eq 2 }</h1>
<h1>1!=2 ${1 ne 2 }</h1>
<h1>!true ${!true}</h1>
<h1>!true ${not true}</h1>


<%
        // 在jsp中的四大作用域中设置值
        pageContext.setAttribute("pagecontext","1");
        request.setAttribute("pagecontext","12");
        request.setAttribute("request","2");
        session.setAttribute("session","3");
        application.setAttribute("application","4");
%>

<%--使用EL表达式将jsp作用域中设置的取出
        El表达式取值顺序  pageContext -> request - > session -> application
--%>

<h2><%=pageContext.getAttribute("pagecontext")%></h2>
<h2>${pagecontext}</h2>
<h2>request:${requestScope.pagecontext}</h2>
<h2>${request}</h2>
<h2>${application}</h2>
<h2>${session}</h2>





</body>
</html>
